a) SCHEMA : (overall structure of database)
  --------
  Column Name , Table name, Database Name

b) ATTRIBUTE : (Column Name)
--------------
c) Entity : ( Table Name )
-------------
d) Tuples : (Value in any row)
-------------

COMMANDS :
----------


DDL (Data Definition language)
(Perform Action on SCHEMA)
  CREATE, DROP, RENAME, ALTER, MODIFY ,TRUNCATE
-------------------------
DML (Data Manipulation Language)
(Perform Action on TUPLES)
  SELECT, INSERT, UPDATE, DELETE
-------------------------
DCL (Data Control Language)
  GRANT ,REVOKE
-------------------------
TCL (Transaction Control Language)
  COMMIT, ROLLBACK, SAVEPOINT, BEGIN

======================================
DELETE VS TRUNCATE
------------------
SIMILARITY :
  * Both are used to remove tuples from Table.
  * TRUNCATE will remove all tuples from table
    so that table looks "empty"
  * DELETE can also do that if we use DELETE
    query without any condition.
    for example:

    DELETE FROM `users`;
     above query will make table empty.

TRUNCATE STEPS:
----------
  1) Takes tmp backup of Database table.
  2) DROP that table.
  3) CREATE that table again with STEP 1
  4) There is no step 4.

  TRUNCATE  = DROP + CREATE
  DDL       = DDL  + DDL

DIFFERENCE :
------------

SET PATH(edit) FOR CMD ACCESS:
C:\xampp\php;C:\xampp\mysql\bin

Rules :

1) Database name, Table name, Column name
   --------------------------------------
   a) must be in lowercase and seperated with
   underscore.
   b) must be enclosed with BACKTICK (`) Symbol.

2) FOR Tuples
   -----------
   a)Must be in single quote(') either it is INT or VARCHAR.

3) TABLE CREATION
   --------------
   a) do not take any prefix for "Column Name"
    for example for "users" table
      id is good
      user_id is bad (user_ is prefix)

   b) First column must be
      column name => id,
      data type => INT,
      size => 11 (if keep blank then take 11 as default)
      AUTO_INCREMENT , PRIMARY KEY

   c) for any table according to need we should take some extra columns as:

      added_date , modified_date, status

4) DATABASE COMMANDS + FUNCTIONS Must be in UPPER CASE

5) TRY to distribute query in several lines
   for example :-
mysql> CREATE TABLE `users`(
    -> `id` INT AUTO_INCREMENT PRIMARY KEY,
    -> `name` VARCHAR(80),
    -> `email` VARCHAR(120),
    -> `password` VARCHAR(32),
    -> `added_date` DATETIME,
    -> `modified_date` TIMESTAMP,
    -> `status` ENUM('0','1')
    -> );
Query OK, 0 rows affected (0.32 sec)

--------------------------------------------
============================================
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
============================================
--------------------------------------------
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\cubes>path
PATH=c:\xampp\php;C:\xampp\php;C:\xampp\mysql\bin;D:\itbs\zend-bin\bin

C:\Users\cubes>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 266
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)

mysql> ByeCtrl-C -- exit!


C:\Users\cubes>mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 267
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| b15                |
| cdcol              |
| joomla             |
| mb120              |
| mb125              |
| mysql              |
| nb158e             |
| nb158f             |
| performance_schema |
| phpcubes           |
| phpmyadmin         |
| plaincart          |
| shop_script        |
| test               |
| webauth            |
| zf_tutorial        |
+--------------------+
17 rows in set (0.08 sec)

mysql> CREATE DATABASE `mb126`;
Query OK, 1 row affected (1.40 sec)

mysql> USE `mb126`;
Database changed
mysql> CREATE TABLE `users`(
    -> `id` INT AUTO_INCREMENT PRIMARY KEY,
    -> `name` VARCHAR(80),
    -> `email` VARCHAR(120),
    -> `password` VARCHAR(32),
    -> `added_date` DATETIME,
    -> `modified_date` TIMESTAMP,
    -> `status` ENUM('0','1')
    -> );
Query OK, 0 rows affected (0.32 sec)

mysql> DESC `users`;
+---------------+---------------+------+-----+-------------------+-----------------------------+
| Field         | Type          | Null | Key | Default           | Extra                       |
+---------------+---------------+------+-----+-------------------+-----------------------------+
| id            | int(11)       | NO   | PRI | NULL              | auto_increment              |
| name          | varchar(80)   | YES  |     | NULL              |                             |
| email         | varchar(120)  | YES  |     | NULL              |                             |
| password      | varchar(32)   | YES  |     | NULL              |                             |
| added_date    | datetime      | YES  |     | NULL              |                             |
| modified_date | timestamp     | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| status        | enum('0','1') | YES  |     | NULL              |                             |
+---------------+---------------+------+-----+-------------------+-----------------------------+
7 rows in set (0.03 sec)

mysql> DESCRIBE `users`;
+---------------+---------------+------+-----+-------------------+-----------------------------+
| Field         | Type          | Null | Key | Default           | Extra                       |
+---------------+---------------+------+-----+-------------------+-----------------------------+
| id            | int(11)       | NO   | PRI | NULL              | auto_increment              |
| name          | varchar(80)   | YES  |     | NULL              |                             |
| email         | varchar(120)  | YES  |     | NULL              |                             |
| password      | varchar(32)   | YES  |     | NULL              |                             |
| added_date    | datetime      | YES  |     | NULL              |                             |
| modified_date | timestamp     | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| status        | enum('0','1') | YES  |     | NULL              |                             |
+---------------+---------------+------+-----+-------------------+-----------------------------+
7 rows in set (0.03 sec)

mysql> SELECT NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2013-10-12 13:45:38 |
+---------------------+
1 row in set (0.06 sec)

mysql> INSERT INTO `users` VALUES(
    -> null,'Vikas Dwivedi','vikas.nice@gmail.com','1q1q1q',NOW(),null,'1'
    -> );
Query OK, 1 row affected (1.72 sec)

mysql> SELECT * FROM `users`;
+----+---------------+----------------------+----------+---------------------+---------------------+--------+
| id | name          | email                | password | added_date          | modified_date       | status |
+----+---------------+----------------------+----------+---------------------+---------------------+--------+
|  1 | Vikas Dwivedi | vikas.nice@gmail.com | 1q1q1q   | 2013-10-12 13:49:45 | 2013-10-12 13:49:45 | 1      |
+----+---------------+----------------------+----------+---------------------+---------------------+--------+
1 row in set (0.00 sec)

mysql> INSERT INTO `users`
    -> (`name`,`password`,`email`,`added_date`,`status`)
    -> VALUES
    -> ('rasmus lerdorf','pass@123','test@php.net',NOW(),'0');
Query OK, 1 row affected (1.80 sec)

mysql> INSERT INTO `users` SET
    -> `name`='zeev@andi.com',
    -> `email`='zeev@zend.com',
    -> `password`='qwerty1234',
    -> `added_date`= NOW(),
    -> `status`='1';
Query OK, 1 row affected (1.72 sec)

mysql> SELECT * FROM `users`;
+----+----------------+----------------------+------------+---------------------+---------------------+--------+
| id | name           | email                | password   | added_date          | modified_date       | status |
+----+----------------+----------------------+------------+---------------------+---------------------+--------+
|  1 | Vikas Dwivedi  | vikas.nice@gmail.com | 1q1q1q     | 2013-10-12 13:49:45 | 2013-10-12 13:49:45 | 1      |
|  2 | rasmus lerdorf | test@php.net         | pass@123   | 2013-10-12 13:51:38 | 2013-10-12 13:51:38 | 0      |
|  3 | zeev@andi.com  | zeev@zend.com        | qwerty1234 | 2013-10-12 13:53:34 | 2013-10-12 13:53:34 | 1      |
+----+----------------+----------------------+------------+---------------------+---------------------+--------+
3 rows in set (0.00 sec)

mysql> SELECT `id`,`name`,`status` FROM `users`;
+----+----------------+--------+
| id | name           | status |
+----+----------------+--------+
|  1 | Vikas Dwivedi  | 1      |
|  2 | rasmus lerdorf | 0      |
|  3 | zeev@andi.com  | 1      |
+----+----------------+--------+
3 rows in set (0.00 sec)

mysql> UPDATE `users` SET
    -> `name`='Divakar Kumar'
    -> WHERE `id`=1;
Query OK, 1 row affected (1.68 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT `id`,`name`,`status` FROM `users`;
+----+----------------+--------+
| id | name           | status |
+----+----------------+--------+
|  1 | Divakar Kumar  | 1      |
|  2 | rasmus lerdorf | 0      |
|  3 | zeev@andi.com  | 1      |
+----+----------------+--------+
3 rows in set (0.00 sec)

mysql> UPDATE `users` SET
    -> `name`='Awadhesh Singh';
Query OK, 3 rows affected (1.70 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> SELECT `id`,`name`,`status` FROM `users`;
+----+----------------+--------+
| id | name           | status |
+----+----------------+--------+
|  1 | Awadhesh Singh | 1      |
|  2 | Awadhesh Singh | 0      |
|  3 | Awadhesh Singh | 1      |
+----+----------------+--------+
3 rows in set (0.00 sec)

mysql> DELETE FROM `users`
    -> WHERE `status`='0';
Query OK, 1 row affected (0.65 sec)

mysql> SELECT `id`,`name`,`status` FROM `users`;
+----+----------------+--------+
| id | name           | status |
+----+----------------+--------+
|  1 | Awadhesh Singh | 1      |
|  3 | Awadhesh Singh | 1      |
+----+----------------+--------+
2 rows in set (0.00 sec)

mysql> DELETE FROM `users`;
Query OK, 2 rows affected (0.08 sec)

mysql> SELECT `id`,`name`,`status` FROM `users`;
Empty set (0.00 sec)


mysql> BEGIN;
Query OK, 0 rows affected (0.00 sec)

mysql> DELETE FROM `users`
    ->      WHERE `status`='0';
Query OK, 1 row affected (0.00 sec)

mysql>    SELECT `id`,`name`,email from users;
+----+---------------+----------------------+
| id | name          | email                |
+----+---------------+----------------------+
|  4 | zeev@andi.com | zeev@zend.com        |
|  6 | Vikas Dwivedi | vikas.nice@gmail.com |
+----+---------------+----------------------+
2 rows in set (0.00 sec)

mysql> ROLLBACK;
Query OK, 0 rows affected (0.08 sec)

mysql>    SELECT `id`,`name`,email from users;
+----+----------------+----------------------+
| id | name           | email                |
+----+----------------+----------------------+
|  4 | zeev@andi.com  | zeev@zend.com        |
|  5 | rasmus lerdorf | test@php.net         |
|  6 | Vikas Dwivedi  | vikas.nice@gmail.com |
+----+----------------+----------------------+
3 rows in set (0.00 sec)

mysql> DELETE FROM `users`
    ->      WHERE `status`='0';
Query OK, 1 row affected (0.08 sec)

mysql> COMMIT;
Query OK, 0 rows affected (0.00 sec)

mysql> ROLLBACK;
Query OK, 0 rows affected (0.00 sec)

mysql>    SELECT `id`,`name`,email from users;
+----+---------------+----------------------+
| id | name          | email                |
+----+---------------+----------------------+
|  4 | zeev@andi.com | zeev@zend.com        |
|  6 | Vikas Dwivedi | vikas.nice@gmail.com |
+----+---------------+----------------------+
2 rows in set (0.00 sec)

mysql>










